<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
<c:choose>
	<c:when test="${bean.cmd == 'add' }">
	   <spring:message  code="pim"/> - <spring:message  code="add.slide.show"/>
	</c:when>
	<c:otherwise>
	   <spring:message  code="pim"/> - <spring:message  code="edit.slide.show"/>
	</c:otherwise>
</c:choose>
</title>
<link href="<%= request.getContextPath() %>/css/custom.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/css/v.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.6.2.js"></script>
<%@include file="script/pim-util.jsp" %>
<%@include file="script/slide-show-script.jsp" %>
<style type="text/css">
.image-preview{
border: 2px double #E0EDF4; 
width: 164px;
margin-top: 0px;
}
</style>
</head>
<body>
<c:if test="${bean.isSigned == true}">
<div id="all">
<div id="wrapper">
<div id="mainheader">
	<jsp:include page="include/common/headerSignedIn.jsp" />
</div> 
<div id="content-wrapper">
<div id="top-menu">
    <jsp:include page="include/common/topMenuHome.jsp" />
</div>
<form:form commandName="slideShowBean" action="" method="post" name="frmSlideShow" enctype="multipart/form-data">
<div class="v-content" style="margin: 10px;">
		<div class="v-row v-border-bottom">
			<div class="v-row-left">
				<span class="v-title"> 
				<c:choose>
						<c:when test='${bean.cmd == "add"}'>
							<spring:message code="add.slide.show" />
						</c:when>
						<c:otherwise>
							<spring:message code="edit.slide.show" />
						</c:otherwise>
				</c:choose> 
				</span>
			</div>
		</div>

		<div class="v-row" id="v-global-message"></div>

		<div class="v-row">
			<div class="v-row-left">
				<span class="v-info"> <spring:message code="warning.news.logo" /> </span>
			</div>
		</div>

		<c:forEach items="${bean.slideShowList}" var="slideShow" varStatus="count">
			<div class="v-row v-border-bottom" style="padding-bottom: 20px;">
				<div class="v-row-left">
					<c:choose>
						<c:when test="${slideShow.path !=null && slideShow.path !=''}">
							<span> 
							    <img onLoad='scaleImg(this, 150, 150)' alt="${slideShow.title}" src="${slideShow.path}" class="image-preview"  id="image-preview-${count.count}" /> 
							</span>
						</c:when>
						<c:otherwise>
							<span> 
							    <img onLoad='scaleImg(this, 150, 150)' alt="" src="<%=request.getContextPath()%>/images/small_noImage.gif" class="image-preview" id="image-preview-${count.count}" /> 
							</span>
						</c:otherwise>
					</c:choose>
				</div>

				<div class="v-row-left" style="padding-left: 20px;">
				        <div>
							<span> <spring:message code="title.required.slideshow.title" /> </span>
						</div>
						<div>
							<span> 
							 <spring:bind path="fileUploadBeans[${count.index}].title">
							    <input type="text" name="${status.expression}" value="${slideShow.title}" class="slideShowTitle" id="slideShowTitle-${count.count}" maxlength="50" /> 
							 </spring:bind>
							</span>
						</div>						
						<div>
							<span> 		
							<spring:bind path="fileUploadBeans[${count.index}].file">					 
							      <input type="file" name="${status.expression}"  size="78" class="file-target" id="file-target-${count.count}"  accept="image/gif, image/jpeg, image/png"/>	
							</spring:bind>						   
							</span> 							
						</div>															
				</div>
			</div>
			<spring:bind path="fileUploadBeans[${count.index}].id">
			  <input type="hidden" name="${status.expression}" value="${slideShow.resourceId}"/>
			</spring:bind>
		</c:forEach>

		<div class="v-row">
			<div class="v-row-center" style="padding-top: 30px; height: 70px;">
				<span> 
				     <input type="button" class="bt-form" name="saveSlideShow" value='<spring:message code="button.save" />' />
			    </span> 
			    <span> 
				     <input type="button" class="bt-form" onclick="javascript:history.back();" value='<spring:message code="button.cancel" />' />
			    </span>
			</div>
		</div>
</div>
<input type="hidden" name="cmd" value="${bean.cmd}"/> 
</form:form>
</div>
</div>
<div class="footer">
	<jsp:include page="include/common/footer.jsp" />
</div>
</div>
</c:if>
</body>
</html>